<template>
  <div class="admin-hospital-manage">
    <!-- 搜索栏 -->
    <el-card class="search-card">
      <div class="search-container">
        <div class="search-row">
          <div class="search-item">
            <label>医院名称：</label>
            <el-input 
              v-model="searchParams.name" 
              placeholder="请输入医院名称" 
              clearable
              style="width: 200px;">
            </el-input>
          </div>
          
          <div class="search-item">
            <label>服务项目：</label>
            <el-input 
              v-model="searchParams.services" 
              placeholder="请输入服务项目" 
              clearable
              style="width: 200px;">
            </el-input>
          </div>
          
          <div class="search-item">
            <label>医院地址：</label>
            <el-input 
              v-model="searchParams.address" 
              placeholder="请输入医院地址" 
              clearable
              style="width: 200px;">
            </el-input>
          </div>
          
          <div class="search-actions">
            <el-button type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button>
            <el-button icon="el-icon-refresh" @click="handleReset">重置</el-button>
            <el-button type="success" icon="el-icon-plus" @click="handleAdd">新增医院</el-button>
            <el-button type="warning" icon="el-icon-download" @click="handleExport">导出Excel</el-button>
          </div>
        </div>
      </div>
    </el-card>
    
    <!-- 医院列表 -->
    <el-card class="table-card">
      <div class="table-header">
        <h3>医院列表</h3>
        <span class="total-count">共 {{ total }} 条数据</span>
      </div>
      
      <el-table 
        :data="hospitalList" 
        v-loading="loading"
        stripe
        style="width: 100%">
        <el-table-column prop="id" label="医院ID" min-width="100" align="center"></el-table-column>
        
        <el-table-column label="医院图片" min-width="150" align="center">
          <template slot-scope="scope">
            <div class="image-stack" v-if="getImageList(scope.row.images).length > 0" @click="handleViewImages(scope.row)">
              <img 
                v-for="(img, index) in getImageList(scope.row.images).slice(0, 3)" 
                :key="index"
                :src="img" 
                :style="{ zIndex: 3 - index, left: index * 8 + 'px' }"
                class="stack-image">
              <span v-if="getImageList(scope.row.images).length > 3" class="image-count">+{{ getImageList(scope.row.images).length - 3 }}</span>
            </div>
            <span v-else style="color: #999;">暂无图片</span>
          </template>
        </el-table-column>
        
        <el-table-column prop="name" label="医院名称" min-width="200">
          <template slot-scope="scope">
            <span style="font-weight: 600; color: #303133;">{{ scope.row.name }}</span>
          </template>
        </el-table-column>
        
        <el-table-column label="服务项目" min-width="250">
          <template slot-scope="scope">
            <div class="service-tags">
              <el-tag 
                v-for="(service, index) in getServiceList(scope.row.services).slice(0, 3)" 
                :key="index"
                type="info" 
                size="small"
                style="margin-right: 5px; margin-bottom: 5px;">
                {{ service }}
              </el-tag>
              <el-tag v-if="getServiceList(scope.row.services).length > 3" size="small">
                +{{ getServiceList(scope.row.services).length - 3 }}
              </el-tag>
            </div>
          </template>
        </el-table-column>
        
        <el-table-column prop="address" label="医院地址" min-width="250">
          <template slot-scope="scope">
            <span style="color: #606266;">{{ scope.row.address }}</span>
          </template>
        </el-table-column>
        
        <el-table-column prop="phone" label="联系电话" min-width="150" align="center">
          <template slot-scope="scope">
            <span style="color: #409eff;">{{ scope.row.phone }}</span>
          </template>
        </el-table-column>
        
        <el-table-column prop="businessHours" label="营业时间" min-width="180">
          <template slot-scope="scope">
            <span style="color: #67c23a;">{{ scope.row.businessHours }}</span>
          </template>
        </el-table-column>
        
        <el-table-column prop="createTime" label="创建时间" min-width="180">
          <template slot-scope="scope">
            {{ formatDate(scope.row.createTime) }}
          </template>
        </el-table-column>
        
        <el-table-column label="操作" min-width="240" align="center" fixed="right">
          <template slot-scope="scope">
            <el-button type="text" icon="el-icon-view" @click="handleView(scope.row)">查看</el-button>
            <el-button type="text" icon="el-icon-edit" @click="handleEdit(scope.row)">编辑</el-button>
            <el-button type="text" icon="el-icon-delete" style="color: #f56c6c;" @click="handleDelete(scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      
      <!-- 分页 -->
      <div class="pagination-container">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="searchParams.page"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="searchParams.size"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total">
        </el-pagination>
      </div>
    </el-card>
    
    <!-- 新增/编辑对话框 -->
    <el-dialog 
      :title="dialogTitle" 
      :visible.sync="dialogVisible" 
      width="900px"
      :close-on-click-modal="false">
      <el-form :model="hospitalForm" :rules="formRules" ref="hospitalForm" label-width="120px">
        <el-form-item label="医院图片" prop="images">
          <div class="upload-container">
            <div class="image-list">
              <div 
                v-for="(img, index) in hospitalForm.imageList" 
                :key="index" 
                class="image-item">
                <img :src="img" alt="医院图片">
                <div class="image-overlay">
                  <i class="el-icon-zoom-in" @click="handlePreviewImage(index)"></i>
                  <i class="el-icon-delete" @click="handleRemoveImage(index)" v-if="dialogMode !== 'view'"></i>
                </div>
              </div>
              
              <el-upload
                v-if="hospitalForm.imageList.length < 5 && dialogMode !== 'view'"
                class="image-uploader"
                action=""
                :show-file-list="false"
                :before-upload="handleBeforeUpload"
                :http-request="handleUploadImage">
                <i class="el-icon-plus upload-icon"></i>
                <div class="upload-text">上传图片</div>
              </el-upload>
            </div>
            <div class="upload-tip">最多可上传5张图片，支持jpg、png格式，单张图片不超过2MB</div>
          </div>
        </el-form-item>
        
        <el-form-item label="医院名称" prop="name">
          <el-input v-model="hospitalForm.name" placeholder="请输入医院名称" :disabled="dialogMode === 'view'"></el-input>
        </el-form-item>
        
        <el-form-item label="医院介绍" prop="introduction">
          <el-input 
            v-model="hospitalForm.introduction" 
            type="textarea"
            :rows="4"
            placeholder="请输入医院介绍" 
            :disabled="dialogMode === 'view'">
          </el-input>
        </el-form-item>
        
        <el-form-item label="服务项目" prop="services">
          <div v-if="dialogMode === 'view'" class="service-tags">
            <el-tag 
              v-for="(service, index) in getServiceList(hospitalForm.services)" 
              :key="index"
              type="info" 
              size="small"
              style="margin-right: 5px; margin-bottom: 5px;">
              {{ service }}
            </el-tag>
          </div>
          <div v-else>
            <div class="service-input-container">
              <el-input 
                v-model="serviceInput" 
                placeholder="请输入服务项目后按回车添加"
                @keyup.enter.native="handleAddService"
                style="width: 400px;">
              </el-input>
              <el-button type="primary" icon="el-icon-plus" @click="handleAddService" style="margin-left: 10px;">添加</el-button>
            </div>
            <div class="service-tags" style="margin-top: 10px;">
              <el-tag 
                v-for="(service, index) in hospitalForm.serviceList" 
                :key="index"
                closable
                @close="handleRemoveService(index)"
                type="info" 
                size="small"
                style="margin-right: 5px; margin-bottom: 5px;">
                {{ service }}
              </el-tag>
            </div>
            <div class="upload-tip">输入服务项目后点击添加或按回车键</div>
          </div>
        </el-form-item>
        
        <el-form-item label="医院地址" prop="address">
          <el-input v-model="hospitalForm.address" placeholder="请输入医院地址" :disabled="dialogMode === 'view'"></el-input>
        </el-form-item>
        
        <el-form-item label="联系电话" prop="phone">
          <el-input v-model="hospitalForm.phone" placeholder="请输入联系电话" :disabled="dialogMode === 'view'"></el-input>
        </el-form-item>
        
        <el-form-item label="营业时间" prop="businessHours">
          <el-input v-model="hospitalForm.businessHours" placeholder="例如：周一至周日 08:00-20:00" :disabled="dialogMode === 'view'"></el-input>
        </el-form-item>
      </el-form>
      
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取消</el-button>
        <el-button type="primary" @click="handleSubmit" v-if="dialogMode !== 'view'" :loading="submitLoading">确定</el-button>
      </div>
    </el-dialog>
    
    <!-- 图片预览对话框 -->
    <el-dialog 
      title="图片预览" 
      :visible.sync="imagePreviewVisible" 
      width="800px"
      :close-on-click-modal="true">
      <div class="image-preview-container">
        <div class="preview-main">
          <i class="el-icon-arrow-left preview-arrow" @click="handlePrevImage" v-if="previewImages.length > 1"></i>
          <img :src="previewImages[currentImageIndex]" class="preview-image">
          <i class="el-icon-arrow-right preview-arrow" @click="handleNextImage" v-if="previewImages.length > 1"></i>
        </div>
        <div class="preview-footer">
          <span>{{ currentImageIndex + 1 }} / {{ previewImages.length }}</span>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { getHospitalList, getHospitalDetail, addHospital, updateHospital, deleteHospital, exportHospitals } from '@/api/hospital';
import { uploadFile } from '@/api/file';

export default {
  name: 'AdminHospitalManage',
  data() {
    return {
      // 搜索参数
      searchParams: {
        page: 1,
        size: 10,
        name: '',
        services: '',
        address: ''
      },
      
      // 医院列表
      hospitalList: [],
      total: 0,
      loading: false,
      
      // 对话框
      dialogVisible: false,
      dialogMode: 'add', // add, edit, view
      dialogTitle: '新增医院',
      submitLoading: false,
      
      // 医院表单
      hospitalForm: {
        id: null,
        images: '',
        imageList: [],
        name: '',
        introduction: '',
        services: '',
        serviceList: [],
        address: '',
        phone: '',
        businessHours: ''
      },
      
      // 服务项目输入
      serviceInput: '',
      
      // 表单验证规则
      formRules: {
        name: [
          { required: true, message: '请输入医院名称', trigger: 'blur' }
        ],
        address: [
          { required: true, message: '请输入医院地址', trigger: 'blur' }
        ],
        phone: [
          { required: true, message: '请输入联系电话', trigger: 'blur' }
        ],
        businessHours: [
          { required: true, message: '请输入营业时间', trigger: 'blur' }
        ]
      },
      
      // 图片预览
      imagePreviewVisible: false,
      previewImages: [],
      currentImageIndex: 0
    };
  },
  
  created() {
    this.loadHospitalList();
  },
  
  methods: {
    /**
     * 加载医院列表
     */
    async loadHospitalList() {
      this.loading = true;
      try {
        const response = await getHospitalList(this.searchParams);
        
        if (response.data.success) {
          const pageData = response.data.data;
          this.hospitalList = pageData.records || [];
          this.total = pageData.total || 0;
        } else {
          this.$notify({
            title: '错误',
            message: response.data.message || '加载医院列表失败',
            type: 'error',
            duration: 2000
          });
        }
      } catch (error) {
        this.$notify({
          title: '错误',
          message: '加载医院列表失败',
          type: 'error',
          duration: 2000
        });
      } finally {
        this.loading = false;
      }
    },
    
    /**
     * 获取图片列表
     */
    getImageList(images) {
      if (!images) return [];
      return images.split(',').filter(img => img.trim());
    },
    
    /**
     * 获取服务项目列表
     */
    getServiceList(services) {
      if (!services) return [];
      return services.split(',').filter(s => s.trim());
    },
    
    /**
     * 查看图片
     */
    handleViewImages(row) {
      this.previewImages = this.getImageList(row.images);
      if (this.previewImages.length > 0) {
        this.currentImageIndex = 0;
        this.imagePreviewVisible = true;
      }
    },
    
    /**
     * 预览图片（表单中）
     */
    handlePreviewImage(index) {
      this.previewImages = [...this.hospitalForm.imageList];
      this.currentImageIndex = index;
      this.imagePreviewVisible = true;
    },
    
    /**
     * 上一张图片
     */
    handlePrevImage() {
      if (this.currentImageIndex > 0) {
        this.currentImageIndex--;
      } else {
        this.currentImageIndex = this.previewImages.length - 1;
      }
    },
    
    /**
     * 下一张图片
     */
    handleNextImage() {
      if (this.currentImageIndex < this.previewImages.length - 1) {
        this.currentImageIndex++;
      } else {
        this.currentImageIndex = 0;
      }
    },
    
    /**
     * 上传前校验
     */
    handleBeforeUpload(file) {
      const isImage = file.type.startsWith('image/');
      const isLt2M = file.size / 1024 / 1024 < 2;
      
      if (!isImage) {
        this.$notify({
          title: '错误',
          message: '只能上传图片文件',
          type: 'error',
          duration: 2000
        });
        return false;
      }
      
      if (!isLt2M) {
        this.$notify({
          title: '错误',
          message: '图片大小不能超过2MB',
          type: 'error',
          duration: 2000
        });
        return false;
      }
      
      return true;
    },
    
    /**
     * 上传图片
     */
    async handleUploadImage(params) {
      try {
        const response = await uploadFile(params.file);
        if (response.data.success) {
          const imageUrl = response.data.data;
          this.hospitalForm.imageList.push(imageUrl);
          this.$notify({
            title: '成功',
            message: '图片上传成功',
            type: 'success',
            duration: 2000
          });
        } else {
          this.$notify({
            title: '错误',
            message: response.data.message || '图片上传失败',
            type: 'error',
            duration: 2000
          });
        }
      } catch (error) {
        this.$notify({
          title: '错误',
          message: '图片上传失败',
          type: 'error',
          duration: 2000
        });
      }
    },
    
    /**
     * 删除图片
     */
    handleRemoveImage(index) {
      this.hospitalForm.imageList.splice(index, 1);
    },
    
    /**
     * 添加服务项目
     */
    handleAddService() {
      if (this.serviceInput && this.serviceInput.trim()) {
        const service = this.serviceInput.trim();
        if (!this.hospitalForm.serviceList.includes(service)) {
          this.hospitalForm.serviceList.push(service);
          this.serviceInput = '';
        } else {
          this.$notify({
            title: '提示',
            message: '该服务项目已存在',
            type: 'warning',
            duration: 2000
          });
        }
      }
    },
    
    /**
     * 删除服务项目
     */
    handleRemoveService(index) {
      this.hospitalForm.serviceList.splice(index, 1);
    },
    
    /**
     * 搜索
     */
    handleSearch() {
      this.searchParams.page = 1;
      this.loadHospitalList();
    },
    
    /**
     * 重置
     */
    handleReset() {
      this.searchParams = {
        page: 1,
        size: 10,
        name: '',
        services: '',
        address: ''
      };
      this.loadHospitalList();
    },
    
    /**
     * 新增医院
     */
    handleAdd() {
      this.dialogMode = 'add';
      this.dialogTitle = '新增医院';
      this.dialogVisible = true;
      this.serviceInput = '';
      this.hospitalForm = {
        id: null,
        images: '',
        imageList: [],
        name: '',
        introduction: '',
        services: '',
        serviceList: [],
        address: '',
        phone: '',
        businessHours: ''
      };
      this.$nextTick(() => {
        if (this.$refs.hospitalForm) {
          this.$refs.hospitalForm.clearValidate();
        }
      });
    },
    
    /**
     * 查看医院详情
     */
    async handleView(row) {
      this.dialogMode = 'view';
      this.dialogTitle = '查看医院详情';
      this.dialogVisible = true;
      
      try {
        const response = await getHospitalDetail(row.id);
        if (response.data.success) {
          const hospitalData = response.data.data;
          this.hospitalForm = {
            ...hospitalData,
            imageList: this.getImageList(hospitalData.images),
            serviceList: this.getServiceList(hospitalData.services)
          };
        }
      } catch (error) {
        this.$notify({
          title: '错误',
          message: '加载医院详情失败',
          type: 'error',
          duration: 2000
        });
      }
    },
    
    /**
     * 编辑医院
     */
    async handleEdit(row) {
      this.dialogMode = 'edit';
      this.dialogTitle = '编辑医院';
      this.dialogVisible = true;
      this.serviceInput = '';
      
      try {
        const response = await getHospitalDetail(row.id);
        if (response.data.success) {
          const hospitalData = response.data.data;
          this.hospitalForm = {
            id: hospitalData.id,
            images: hospitalData.images,
            imageList: this.getImageList(hospitalData.images),
            name: hospitalData.name,
            introduction: hospitalData.introduction,
            services: hospitalData.services,
            serviceList: this.getServiceList(hospitalData.services),
            address: hospitalData.address,
            phone: hospitalData.phone,
            businessHours: hospitalData.businessHours
          };
        }
      } catch (error) {
        this.$notify({
          title: '错误',
          message: '加载医院详情失败',
          type: 'error',
          duration: 2000
        });
      }
      
      this.$nextTick(() => {
        if (this.$refs.hospitalForm) {
          this.$refs.hospitalForm.clearValidate();
        }
      });
    },
    
    /**
     * 删除医院
     */
    handleDelete(row) {
      this.$confirm('确定要删除该医院吗？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(async () => {
        try {
          const response = await deleteHospital(row.id);
          if (response.data.success) {
            this.$notify({
              title: '成功',
              message: '删除成功',
              type: 'success',
              duration: 2000
            });
            // 删除后刷新列表
            this.loadHospitalList();
          } else {
            this.$notify({
              title: '错误',
              message: response.data.message || '删除失败',
              type: 'error',
              duration: 2000
            });
          }
        } catch (error) {
          this.$notify({
            title: '错误',
            message: '删除失败',
            type: 'error',
            duration: 2000
          });
        }
      }).catch(() => {});
    },
    
    /**
     * 提交表单
     */
    handleSubmit() {
      this.$refs.hospitalForm.validate(async (valid) => {
        if (valid) {
          this.submitLoading = true;
          try {
            // 将图片列表转换为逗号分隔的字符串
            const submitData = {
              ...this.hospitalForm,
              images: this.hospitalForm.imageList.join(','),
              services: this.hospitalForm.serviceList.join(',')
            };
            delete submitData.imageList;
            delete submitData.serviceList;
            
            let response;
            if (this.dialogMode === 'add') {
              response = await addHospital(submitData);
            } else {
              response = await updateHospital(submitData);
            }
            
            if (response.data.success) {
              this.$notify({
                title: '成功',
                message: this.dialogMode === 'add' ? '新增成功' : '更新成功',
                type: 'success',
                duration: 2000
              });
              this.dialogVisible = false;
              // 新增或编辑成功后刷新列表
              this.loadHospitalList();
            } else {
              this.$notify({
                title: '错误',
                message: response.data.message || '操作失败',
                type: 'error',
                duration: 2000
              });
            }
          } catch (error) {
            this.$notify({
              title: '错误',
              message: '操作失败',
              type: 'error',
              duration: 2000
            });
          } finally {
            this.submitLoading = false;
          }
        }
      });
    },
    
    /**
     * 导出Excel
     */
    handleExport() {
      const params = {
        name: this.searchParams.name,
        services: this.searchParams.services,
        address: this.searchParams.address
      };
      
      const exportUrl = exportHospitals(params);
      window.open(exportUrl, '_blank');
      
      this.$notify({
        title: '提示',
        message: '正在导出，请稍候...',
        type: 'info',
        duration: 2000
      });
    },
    
    /**
     * 分页大小改变
     */
    handleSizeChange(size) {
      this.searchParams.size = size;
      this.searchParams.page = 1;
      this.loadHospitalList();
    },
    
    /**
     * 当前页改变
     */
    handleCurrentChange(page) {
      this.searchParams.page = page;
      this.loadHospitalList();
    },
    
    /**
     * 格式化日期
     */
    formatDate(date) {
      if (!date) return '';
      const d = new Date(date);
      const year = d.getFullYear();
      const month = String(d.getMonth() + 1).padStart(2, '0');
      const day = String(d.getDate()).padStart(2, '0');
      const hour = String(d.getHours()).padStart(2, '0');
      const minute = String(d.getMinutes()).padStart(2, '0');
      const second = String(d.getSeconds()).padStart(2, '0');
      return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
    }
  }
};
</script>

<style scoped>
.admin-hospital-manage {
  padding: 20px;
  background: #f0f2f5;
  min-height: calc(100vh - 40px);
}

/* 搜索卡片 */
.search-card {
  margin-bottom: 20px;
  border-radius: 8px;
  height: 140px;
}

.search-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
}

.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-item label {
  font-weight: 500;
  color: #333;
  white-space: nowrap;
}

.search-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

/* 表格卡片 */
.table-card {
  border-radius: 8px;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.table-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.total-count {
  color: #666;
  font-size: 14px;
}

/* 图片层叠展示 */
.image-stack {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto;
  cursor: pointer;
}

.stack-image {
  position: absolute;
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.3s;
}

.stack-image:hover {
  transform: translateY(-5px);
}

.image-count {
  position: absolute;
  bottom: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 12px;
  z-index: 10;
}

/* 服务项目标签 */
.service-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.service-input-container {
  display: flex;
  align-items: center;
}

/* 上传容器 */
.upload-container {
  width: 100%;
}

.image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.image-item {
  position: relative;
  width: 120px;
  height: 120px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  overflow: hidden;
}

.image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  opacity: 0;
  transition: opacity 0.3s;
}

.image-item:hover .image-overlay {
  opacity: 1;
}

.image-overlay i {
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.3s;
}

.image-overlay i:hover {
  transform: scale(1.2);
}

.image-uploader {
  width: 120px;
  height: 120px;
  border: 1px dashed #d9d9d9;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: border-color 0.3s;
}

.image-uploader:hover {
  border-color: #409eff;
}

.upload-icon {
  font-size: 28px;
  color: #8c939d;
}

.upload-text {
  margin-top: 8px;
  color: #8c939d;
  font-size: 12px;
}

.upload-tip {
  color: #999;
  font-size: 12px;
  line-height: 1.5;
}

/* 图片预览 */
.image-preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-main {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 500px;
}

.preview-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.preview-arrow {
  position: absolute;
  font-size: 30px;
  color: #409eff;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.9);
  padding: 10px;
  border-radius: 50%;
  transition: all 0.3s;
}

.preview-arrow:hover {
  background: #409eff;
  color: #fff;
}

.preview-arrow.el-icon-arrow-left {
  left: 20px;
}

.preview-arrow.el-icon-arrow-right {
  right: 20px;
}

.preview-footer {
  margin-top: 20px;
  color: #666;
  font-size: 14px;
}

/* 分页 */
.pagination-container {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

/* 对话框 */
.dialog-footer {
  text-align: right;
}

/* 响应式设计 */
@media (max-width: 1200px) {
  .search-row {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .search-actions {
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
  }
}
</style>

